package org.lds.hotkey.common.exception;


import org.lds.hotkey.common.enums.ErrCodeEnum;

/**
 * 自定义业务异常
 *
 * @author lidongsheng 2021/3/10 16:52
 * @version V1.0
 */
public class BusinessException extends RuntimeException {

    private BusinessExceptionMessage exceptionMessage;

	public BusinessException() {
        exceptionMessage = new BusinessExceptionMessage();
	}

    public BusinessException(String errorCode, String errorMessage) {
        exceptionMessage = new BusinessExceptionMessage(errorCode, errorMessage);
    }

    public BusinessException(ErrCodeEnum errCodeEnum) {
        exceptionMessage = new BusinessExceptionMessage(errCodeEnum.getErrCode(), errCodeEnum.getErrMsg());
    }

    public BusinessExceptionMessage getExceptionMessage() {
        return exceptionMessage;
    }

    @Override
    public String getMessage() {
        return exceptionMessage.getErrorMessage();
    }

}
